using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Public_Feedback : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label5.Font.Bold = true;
        Label5.Font.Size = 15;
        Label5.ForeColor = System.Drawing.Color.Blue;

        try
        {
            SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Con"].ToString());
            con.Open();
            SqlCommand cmd = new SqlCommand("insert into Feedback values (@DeliveryNo, @CustID, @Content, 0)", con);
            cmd.Parameters.AddWithValue("DeliveryNo", txtDeliveryNo.Text);
            cmd.Parameters.AddWithValue("CustID", txtCustID.Text);
            cmd.Parameters.AddWithValue("Content", txaContent.Text);
            cmd.ExecuteNonQuery();
            con.Close();

            Label5.Text = "Your feedback has been sent.";
        }
        catch (SqlException dex)
        {
            Label5.ForeColor = System.Drawing.Color.Red;
            Label5.Text = "You have already sent feedback of this deliverable.";
        }
    }
}
